package com.example.administrator.viewpager;


import java.io.Serializable;
import java.util.List;

public class BaseModel<T> implements Serializable {
    private int errorCode;
    private String errorMsg;
    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public int getCode() {
        return errorCode;
    }

    public void setCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getMsg() {
        return errorMsg;
    }

    public void setMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public boolean isSuccess() {
        return errorCode == 0;
    }

    public boolean isListEmpty() {
        return data == null || (data instanceof List && ((List) data).size() == 0);
    }

    //token过期
    public boolean isTokenInvalid() {
        return errorCode == 222222;
    }
}
